import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import axios from 'axios'
import './assets/iconfont/iconfont.css'

axios.defaults.baseURL = process.env.NODE_ENV === 'development' ? 'api' : 'https://sz.fangmw.com'
// axios.defaults.baseURL =  'api' 
axios.interceptors.request.use(config => {
    config.headers = {
        'Content-Type': 'application/x-www-form-urlencoded'
    }
    return config
})
document.title = '房盟网'
axios.interceptors.response.use(config => {

  
    setTimeout(() => {
    }, 300)
    
    if(config.status == 200) {
        let { data } =  config
        if(data.code == 1) { 
            return data
        }
        if(data.code == 0) {
            console.log('错误')
        }
    }
    
    
}, e => {
    const { error } = e.response.data
    return Promise.reject(error)
})

const app = createApp(App)

app.use(store)
app.use(router)
app.mount('#app')
